var apis = {
	loginer: "http://api.fangchepingtai.com/fangchebbs/user/loginer",
	loginout: "http://api.fangchepingtai.com/fangchebbs/user/loginout"
};
(function() {
	Path.on("/user/*", function() {
		// 重新拉取登陆信息
		coAjax.post(apis.loginer, function(result) {
			console.log(result)
			if (result) {
				App.set("loginer", result);
			};
		}, function(err, errMsg) {
			console.log(errMsg)
			myConfirm("您已退出登陆，请重新登陆", function() {
				Path.jump("/login.html");
			}, function() {
				Path.jump("/main.html");
			});
		});
	});
	// 退出登陆
	App.set("$Event.user.loginout", function() {
		myConfirm("确定要退出登陆吗？", function() {
			coAjax.post(apis.loginout, function() {
				App.set("loginer", "");
				alert("success", "您已退出登陆");
				Path.jump("/main.html");
			}, function(err, errMsg) {
				console.log(errMsg);
			});
		});
	});
}());